<script type="text/javascript">
  function review_vote(a,b){
    <%#*$.ajax({       //Ajax函数%>
      <%#*type: 'post',   //定义http方法%>
      <%#*data: { 'item_review_id': a,'vote' :b },%>
      <%#*url: "/item_review_votes",    //请求的URL%>
      <%#*success: function(data){%>
        <%#*$(this).text(data["up_vote"]);%>
      <%#*} //请求成功之后的动作%>
    <%#*})%>
  }
</script>
<div class="comment">
  <div class="conner_greengray_top">
    <h2 class="green_tab clearfix" id="comment_tab">
      <span class="ll idTabs">
        <%= link_to "<span> 热门点评 </span>","#reviews_1",:class=>"on" %>
        <%= link_to "<span> 最新点评 </span>","#reviews_2" %>
      </span>
      <span class="rr pl">共<%= link_to @item.reviews.count,'/' %>条点评
        <%= l_u(@item) %>
      </span> 
    </h2>
  </div>

  <div class="conner_greengray_line">
    <% @hot_latest_reviews.each_with_index do |reviews,i| -%>
      <div id="reviews_<%= i+1 %>" style="<%=i==0 ? 'display:black' : 'display:none' %>">
        <% reviews.each do |review| -%>
          <% r_user = review.user %>
          <div class="ctsh">
            <ul style="clear: both;" class="tlst clearfix">
              <li class="nlst">
                <h3>
                  <span class="ll">
                    <%= link_to "#{r_user.nick_name}", user_path(:id=>review.user_id) %>
                    <%= r_user.points %>
                  </span>
                  <div class="rr swith_review">
                    <a style="background: none repeat scroll 0% 0% transparent;" class="j" href="javascript:void(0)" id="on_<%= review.id %>">
                      <img title="展开全文" alt="&gt;" src="images/arrow3.gif"/>
                    </a>
                    <a style="background: none repeat scroll 0% 0% transparent; display: none;" class="j" href="javascript:void(0);" id="off_<%= review.id %>">
                      <img title="缩进全文" alt="&lt;" src="images/arrow2.gif"/>
                    </a>
                  </div>
                </h3>
              </li>
              <li style="clear: both;" class="ilst">
                <%= link_to image_tag(r_user.pic.url(:small) || '',:alt=>'头像',:class=>"pil"), user_path(r_user) %>
              </li>
              <li class="clst">
                <ul class="clst_star">
                  <li>
                    <% user_rating = @item.user_rating(r_user) %>
                    <span class="font_color<%= user_rating.try(:global_rating).to_i%>">综合:</span>
                    <span title="星星" class="stars<%= user_rating.try(:global_rating).to_i%> stars"></span>
                  </li>
                  <li>
                    <span class="font_color<%= user_rating.try(:impression_rating).to_i%>">外观:</span>
                    <span title="星星" class="stars<%= user_rating.try(:impression_rating).to_i%> stars"></span></li>
                  <li>
                    <span class="font_color<%= user_rating.try(:quality_rating).to_i%>">质地:</span>
                    <span title="星星" class="stars<%= user_rating.try(:quality_rating).to_i%> stars"></span>
                  </li>
                </ul>
                <div class="clear"></div>
                <div>
                  &nbsp;&nbsp;&nbsp;&nbsp;
                  <span id="review_short_<%= review.id %>"><%=h truncate_u(review.content,150) %></span>
                  <span id="review_long_<%= review.id %>" style="display:none"><%=h review.content %></span>
                  <div class="pl clearfix"> <span class="fleft">
                      <%= review.created_at.strftime("%Y-%m-%d") %>
                      &nbsp;｜<a href="#"><%= review.reply_count %>人回应</a></span>
                    <div class="rr">
                      <span>
                        <a title="有用" class="report_1" href="javascript:void(0)" onclick="review_vote(<%= review.id %>,1)">45<span></span></a>
                        |<a title="无用" class="report_2" href="javascript:void(0)" onclick="review_vote(<%= review.id %>,0)">45<span></span></a>
                        |<a class="report_3" href="#">&nbsp;<span></span> 举报</a>
                      </span></div>
                  </div>
                </div>
              </li>
            </ul>
          </div>
          <div class="clear"></div>
        <% end -%>
        <p align="right" style="padding-right: 20px;" class="pl">&gt; <a href="#">更多评论</a></p>
      </div>
    <% end -%>
  </div>
  <div class="conner_greengray_bottom"></div>
</div>

